/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package networkowner.bo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ool
 */
@Entity
@Table(name = "RECIEVED_MESSAGES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RecievedMessages.findAll", query = "SELECT r FROM RecievedMessages r"),
    @NamedQuery(name = "RecievedMessages.findById", query = "SELECT r FROM RecievedMessages r WHERE r.id = :id"),
    @NamedQuery(name = "RecievedMessages.findByTime", query = "SELECT r FROM RecievedMessages r WHERE r.time = :time")})
public class RecievedMessages implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Long id;
    @Lob
    @Column(name = "BODY")
    private byte[] body;
    @Column(name = "TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date time;

    public RecievedMessages() {
    }

    public RecievedMessages(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public byte[] getBody() {
        return body;
    }

    public void setBody(byte[] body) {
        this.body = body;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RecievedMessages)) {
            return false;
        }
        RecievedMessages other = (RecievedMessages) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "networkowner.bo.RecievedMessages[ id=" + id + " ]";
    }
    
}
